package cn.smile;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;

@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient
public class SpringcloudApigetwayApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringcloudApigetwayApplication.class, args);
    }


    @Bean
    public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){
        RedisTemplate redisTemplate=new RedisTemplate();
        redisTemplate.setEnableTransactionSupport(true);
        StringRedisSerializer serializer=new StringRedisSerializer();
        redisTemplate.setKeySerializer(serializer);
        redisTemplate.setKeySerializer(serializer);
        redisTemplate.setConnectionFactory(redisConnectionFactory);
        return redisTemplate;
    }

}
